package com.example.lenovo.wechat;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;



import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
;
import android.widget.Button;
import android.widget.EditText;

import java.util.ArrayList;
import java.util.List;

import static android.support.constraint.Constraints.TAG;

/**
 * A simple {@link Fragment} subclass.
 */
public class WeChatFragment extends Fragment {




    private List<Chat> chatList = new ArrayList<>();


    public WeChatFragment() {
        // Required empty public constructor
    }



    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_we_chat, container, false);

        RecyclerView recyclerView = view.findViewById(R.id.chat_recycler_view);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        chatList.add(new Chat(R.drawable.head1, "聊天"));
        chatList.add(new Chat(R.drawable.head1, "聊天"));
        chatList.add(new Chat(R.drawable.head1, "聊天"));

        ChatAdapter adapter = new ChatAdapter(getActivity(),chatList);
        recyclerView.setAdapter(adapter);
        return view;
    }


    }



